﻿Public Class Template

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'DigitalDocumentDataSet.Layer' table. You can move, or remove it, as needed.
        Me.LayerTableAdapter.Fill(Me.DigitalDocumentDataSet.Layer)
        'TODO: This line of code loads data into the 'DigitalDocumentDataSet.Template' table. You can move, or remove it, as needed.
        Me.TemplateTableAdapter.Fill(Me.DigitalDocumentDataSet.Template)

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
        Layer.Show()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        Me.Validate()
        Me.TemplateBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.DigitalDocumentDataSet)
        MsgBox("Saved")
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDel.Click
        Me.Validate()
        'Me.TemplateTableAdapter.Delete(Me.NameTextBox.Text, Me.CssTextBox.Text)

        Me.TemplateTableAdapter.Fill(Me.DigitalDocumentDataSet.Template)

        MsgBox("deleted")

    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnChange.Click

        Me.Text = ListBox1.GetItemText(NameTextBox)
        'mesa sth lista kanonika emfanizontai ta templateID p yparxoun sto layer
        Layer.Text = ListBox1.GetItemText(NameTextBox)

        NameTextBox.Focus()

        TemplateTableAdapter.Update(DigitalDocumentDataSet.Template)

    End Sub
End Class
